<template>
  <div class="more-list">
    <h3>{{ this.$route.params.title }}</h3>
    <div class="wrapper">
      <router-link class="info" v-for="(item,index) in newMusicData" :key="index"  :to="{name:'MusicPlay',params:{songId: item.id}}" >
        <div class="poster">
          <img :src="item.album.picUrl" :alt="item.title" ref="image" />
        </div>
        <div class="text-wrap">
          <div class="title" ref="text">{{ item.name }}</div>
          <div class="singer">{{ item.artists[0].name}}</div>
        </div>
      </router-link>
      <div>
      <p>更多歌曲敬请期待~</p>
    </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "morenew",
  data() {
    return {
      newMusicData: []
    };
  },
  mounted() {
    // musicType:2：新歌速递；
    var newMusicUrl = this.HOST + "/top/song?type=0";
    this.$axios
      .get(newMusicUrl)
      .then(res => {
        this.newMusicData = [
          res.data.data[0],
          res.data.data[1],
          res.data.data[2]
        ];
      })
      .catch(err => console.log('新歌速递报错', err.response.data.message));
  }
};
</script>

<style scoped>
.more-list {
  background: #fff;
}
h3 {
  padding: 20px;
}
.wrapper {
  text-align: center;
  margin-bottom: 10px;
  clear: both;
  margin: 10px auto;
}

.wrapper .info {
  width: 80%;
  height: 200px;
  text-align: center;
  padding-left: 20px;
  display: block;
  margin-bottom: 25px;
  margin-left: 20px;
  margin-right: 20px;
  position: relative;
  display: flex;
  font-size: 12px;
  background-color: rgba(206, 220, 224,0.5);
}

.wrapper .info .poster {
  height: 90%;
  width: 60%;
}

.wrapper .info .poster img {
  height: 90%;
  max-width: 180px;
  padding-top: 15px;
}
.wrapper .info .text-wrap {
  text-overflow: ellipsis;
  white-space: wrap;
  width: 40%;
  text-align: left;
  padding-top: 20%;
}

.wrapper .info .text-wrap span {
  width: 100%;
  padding-right: 20px;
}

div p {
  text-align: center;
}
</style>